package utils;

public class ThreadCritical
{
    private boolean lock = false;

    public synchronized void getLock()
    {
        if (lock)
        {
            try
            {
                wait();
            }
            catch (InterruptedException e)
            {
                e.printStackTrace();
            }
        }
        lock = true;
    }

    public synchronized void releaseLock()
    {
        lock = false;
        notify();
    }
}
